#include "dialogaddobject.h"
#include "ui_dialogaddobject.h"

DialogAddObject::DialogAddObject(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::DialogAddObject)
{
    ui->setupUi(this);


}

DialogAddObject::~DialogAddObject()
{
    delete ui;
}

void DialogAddObject::on_buttonBox_accepted(){
    ok = true;
    if(ui->radioSphere->isChecked()) type = SPHERE;
    else if(ui->radioBox->isChecked()) type = BOX;
    else if(ui->radioTriMesh->isChecked()) type = TRIMESH;
    else {
        ok = false;
        type = NO;
        return;
    }

    switch(type)
    {
        case SPHERE:
                  radius = ui->editRadius->text().toFloat(&ok); break;
        case BOX: sizeBox[0] = ui->editSizeX->text().toFloat(&ok);
                  sizeBox[1] = ui->editSizeY->text().toFloat(&ok);
                  sizeBox[2] = ui->editSizeZ->text().toFloat(&ok);
                  break;
        case TRIMESH: filename = ui->editFilename->text(); break;
    }
}
